<template>
    <div class="app-container">
        <levelbar></levelbar>
        <el-form label-width="70px" class="app-content" :model="ruleForm" ref="ruleForm" label-position="left">
            <div class="box">
            <div class="appTop"><P>家长身份</p></div>
            <el-row :gutter="20" v-for="(site,index) in ruleForm.dataForm" :key="index">
                    <el-col :span="6">
                        <el-form-item label="关联学生">
                            <span>{{site.studentName}}</span>
                        </el-form-item>
                    </el-col>
                    <el-col :span="6">
                        <el-form-item label="e学云ID号">
                                  <span>{{site.exueCode}}</span>
                        </el-form-item>
                    </el-col>
                     <el-col :span="6" >
                        <el-form-item label="关系">
                               <span>{{site.relation}}</span>
                        </el-form-item>
                    </el-col>
                    <el-col :span="6" >
                        <el-form-item  prop="checkMange"  v-model="site.checkMange">
                            <el-button type="primary" @click="checkParentManage(site.studentId)">查看</el-button>
                        </el-form-item>
                    </el-col>
            </el-row>
                <div class="appTop"><P>注册信息</p></div>
                <el-row>                   
                    <el-col :span="9">
                        <el-form-item label="姓名">
                              <span>{{ruleForm.realName}}</span>
                        </el-form-item>
                    </el-col>
                    <el-col :span="9" :offset="5">
                        <el-form-item label="手机号">
                            <span>{{ruleForm.phone}}</span>
                            
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="9">
                        <el-form-item label="e学云ID号">
                             <span>{{ruleForm.studentId}}</span>
                        </el-form-item>
                    </el-col>
                    <el-col :span="9" :offset="5">
                        <el-form-item label="注册情况">
                              <span>{{ruleForm.enrollSituation}}</span>
                        </el-form-item>
                    </el-col>
                </el-row>
                <div class="appTop"><P>基础信息</p></div>
                    <el-row>
                        <el-col :span="7">
                            <el-form-item label="所在省">
                                 <span>{{ruleForm.fProvinceName}}</span>
                            </el-form-item>         
                        </el-col>
                        <el-col :span="7" :offset="1">
                            <el-form-item label="所在市">
                                 <span>{{ruleForm.fCityName}}</span>

                            </el-form-item>
                        </el-col>
                        <el-col :span="7" :offset="1">
                            <el-form-item label="所在区县">
                                  <span>{{ruleForm.fAreaName}}</span>
                            </el-form-item>
                        </el-col>
                    </el-row>
                <el-form-item class="footer">
                    <el-button @click="submitForm">返回</el-button>
                </el-form-item>
            </div>
        </el-form>
    </div>
</template>

<script>
import Levelbar from '../layout/Levelbar';
import {viewParentInfo} from 'api/parentManagement';
import { mapGetters } from 'vuex';
export default{
    name: 'checkParentManage',
    components: {Levelbar},
    data() {
        return {
            ruleForm: {
                realName: '',
                fProvinceName: '',
                fCityName: '',
                fAreaName: '',
                studentId: '',
                enrollSituation: '',
                phone: '',
                dataForm: []
            }
        }
    },
    created() {
        this.checkViewParentInfo();
    },
    computed: {
        ...mapGetters([
            'uid'
        ])
    },
    methods: {
        checkViewParentInfo() {
            viewParentInfo(this.$route.params.userId, this.$route.params.exueId).then(response => {
                this.ruleForm.fProvinceName = response.data.content.provinces.province;
                this.ruleForm.fCityName = response.data.content.provinces.city;
                this.ruleForm.fAreaName = response.data.content.provinces.area;
                this.ruleForm.realName = response.data.content.registration.name;
                this.ruleForm.phone = response.data.content.registration.phone;
                this.ruleForm.studentId = response.data.content.registration.exueCode;
                this.ruleForm.enrollSituation = response.data.content.registration.registration == true ? '已注册' : '未注册';
                this.ruleForm.dataForm = response.data.content.studentParentRelation;
            });
        },
        checkParentManage(studentId) {
            this.$router.push({path: `studentManage/studentInforPage/${studentId}`});
        },
        submitForm() {
            this.$router.push({path: '/parentManagement'});
        }
    }
}
</script>

<style lang="scss" scoped>
.app-container {
    position: relative;
    padding: 20px 20px 10px;
    .app-levelbar {
        height: 35px;
    }
    .el-row{
        padding-left:70px
    }
    .el-form{
        padding-Top:30px;
        background:#fff;
        padding-bottom:170px;
        .appTop{
            padding:40px 0 20px 50px;
            margin-bottom:10px;
            position:relative;
        }
        .appTop:before {
            content: '';           
            float: left;
            border-radius: 2px;
            width:4px;height:20px;
            background:#ff5e2c;
            margin-top:1px;
        }
        .appTop p{
            margin-left:15px;
        }
        .el-form-item{
            margin-top:8px;
        }

        .addContinue{
            margin-left:60px;
            margin-top:20px
        }
        .appTitle{
            padding:40px 0 30px 50px;
            margin-bottom:30px;
            padding-top:10px;
            text-align:center;
            border-bottom:1px solid #ECECEC
        }
        .box{
            margin-left:20px;
            padding-bottom:10px;
            background:#fff;
        }
        .el-tag{
            margin-left:10px;
            background:#f9f9f9;
            color:#444;
        }
        .footer{
            text-align:center;
            margin-top:100px;
        }
        .footer .el-button{
            padding:10px 40px;
        }
    }
    
}

</style>